<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport"
        content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no, viewport-fit=cover" />
    <title>值班长</title>
    <link rel="stylesheet" href="css/vant.css">
    <link rel="stylesheet" href="css/shareDownPage.css">
</head>

<body>
    <div id="app" v-cloak>
        {{str}}
        <div class="shareTit">
            <div>
                <span>ZHI</span>
                <span>BAN</span>
                <span>ZHANG</span>
            </div>
            <div>
                <span>健</span>
                <span>康</span>
                <span>科</span>
                <span>普</span>
                <span>护</span>
                <span>佑</span>
                <span>健</span>
                <span>康</span>
            </div>
        </div>
        <div class="shopInfo" v-if="shopInfo!=''">
            <div>{{shopInfo.shopName}}</div>
            <div>地址：{{shopInfo.shopAddres==null?'暂无地址信息':shopInfo.shopAddres}}</div>
            <div>联系电话：{{shopInfo.shopTel==null?'暂无联系电话':shopInfo.shopTel}}</div>
        </div>
        <div class="zbzLogo">
            <!-- <img src="./img/about.png" alt="logo"> -->
            <div>
                <span>全病程管理</span>
                <span>享受健康生活就来吉医护理</span>
            </div>
        </div>
        <div class="pageMain">
            <img class="topMain" src="img/sharePage2.png" alt="">
            <img class="bottomMain" src="img/sharePage1.png" alt="">
        </div>
        <!-- 按钮 -->
        <div class="btn" @click="downHandle">
            立即下载
        </div>
        <div class="downBox" v-if="showPop" @click="showPop=false">
            <img src="./img/downTip.png" alt="">
        </div>
    </div>



    <script src="js/vue.min.js"></script>
    <script src="js/flex_ible/lib-flexible.js"></script>
    <script src="js/vue-lazyload.js"></script>
    <script src="js/vant.min.js"></script>
    <script src="js/vue-lazyload.js"></script>
    <script src="js/url.js" type="text/javascript" charset="utf-8"></script>
    <script type="text/javascript" src="https://res2.wx.qq.com/open/js/jweixin-1.6.0.js"></script>

    <!-- <script src="https://cdn.jsdelivr.net/npm/mobile-detect.js"></script> -->
    <!-- <script src="https://cdn.jsdelivr.net/npm/mobile-detect@1.4.4/mobile-detect.min.js"></script> -->



    <script src="js/ajax.js"></script>
    <script>
        var ua = navigator.userAgent.toLowerCase();
        var isWeixin = ua.indexOf('micromessenger') != -1;

        console.log(isWeixin);
        Vue.use(VueLazyload);
        var vm = new Vue({
            el: "#app",
            data: {
                str: '',
                showPop: false,
                shopInfo: sessionStorage.getItem('shop') == null ? '' : JSON.parse(sessionStorage.getItem('shop'))
            },
            created() {
                if (this.shopInfo != '') {
                    this.setTitle(this.shopInfo.shopName)
                }
                // this.getHandle()
                alert(this.judgeBrand(window.navigator.userAgent.toLowerCase()))
            },
            methods: {
                judgeBrand(sUserAgent) {
                    alert(sUserAgent)
                    var isIphone = sUserAgent.match(/iphone/i) == 'iphone';
                    var isHuawei = sUserAgent.match(/huawei/i) == 'huawei';
                    var isNova = sUserAgent.match(/jef/i) == 'jef';
                    var isHonor = sUserAgent.match(/honor/i) == 'honor';
                    var isOppo = sUserAgent.match(/oppo/i) == 'oppo';
                    var isOppoR15 = sUserAgent.match(/pacm00/i) == 'pacm00';
                    var isOppoR17 = sUserAgent.match(/pbem00/i) == 'pbem00';
                    var isVivo = sUserAgent.match(/vivo/i) == 'vivo';
                    var isXiaomi = sUserAgent.match(/mi\s/i) == 'mi';
                    var isXiaomi2s = sUserAgent.match(/mix\s/i) == 'mix';
                    var isRedmi = sUserAgent.match(/redmi/i) == 'redmi';
                    var isSamsung = sUserAgent.match(/sm-/i) == 'sm-';
                    var isLG = sUserAgent.match(/lg/i) == 'lg';
                    var isRealMe = sUserAgent.match(/rmx/i) == 'rmx';
                    if (isIphone) {
                        return 'iPhone';
                    } else if (isHuawei) {
                        return 'Huawei';
                    } else if (isHonor) {
                        return 'Honor'
                    } else if (isOppo || isOppoR15 || isOppoR17) {
                        return 'Oppo';
                    } else if (isVivo) {
                        return 'vivo';
                    } else if (isXiaomi || isRedmi || isXiaomi2s) {
                        return 'mi';
                    } else if (isSamsung) {
                        return 'Samsung';
                    } else if (isLG) {
                        return 'LG';
                    } else if (isRealMe) {
                        return 'realme';
                    } else {
                        return '其他型号手机';
                    }
                },


                getHandle() {
                    //判断数组中是否包含某字符串 
                    Array.prototype.contains = function (needle) {
                        for (i in this) {
                            if (this[i].indexOf(needle) > 0)
                                return i;
                        }
                        return -1;
                    }
                    var device_type = navigator.userAgent; //获取userAgent信息 
                    document.write(device_type); //打印到页面 
                    var md = new MobileDetect(device_type); //初始化mobile-detect 
                    alert(JSON.stringify(md))
                    var os = md.os(); //获取系统 
                    var model = "";
                    if (os == "iOS") { //ios系统的处理 
                        os = md.os() + md.version("iPhone");
                        model = md.mobile();
                    } else if (os == "AndroidOS") { //Android系统的处理 
                        os = md.os() + md.version("Android");
                        var sss = device_type.split(";");
                        var i = sss.contains("Build/");
                        if (i > -1) {
                            model = sss[i].substring(0, sss[i].indexOf("Build/"));
                        }
                    }
                    alert(os + "---" + model); //打印系统版本和手机型号
                },

                setTitle(name) {
                    document.title = name
                    const i = document.createElement('iframe')
                    i.src = '/favicon.ico'
                    i.style.display = 'none'
                    i.onload = function () {
                        setTimeout(function () {
                            i.remove()
                        }, 9)
                    }
                    document.body.appendChild(i)
                },

                downHandle: function () {
                    console.log(window);

                    // alert(window.navigator.userAgent)
                    // alert(window.navigator.platform)
                    // alert(window.navigator.appName)
                    // return
                    if (window.navigator.userAgent.match(/(iPhone|iPod|iPad);?/i)) {
                        console.log("000");
                        var loadDateTime = new Date();
                        window.location = "clinic://"; //schema链接或者universal link
                        window.setTimeout(
                            function () { //如果没有安装app,便会执行setTimeout跳转下载页
                                var timeOutDateTime = new Date();
                                if (timeOutDateTime - loadDateTime < 5000) {
                                    window.location =
                                        "https://itunes.apple.com/cn/app/%E5%80%BC%E6%97%A5%E7%94%9F/id1448441059?mt=8"; //ios下载地址  
                                } else {
                                    window.close();
                                }
                            }, 500);
                    } else if (window.navigator.userAgent.match(/android/i)) {
                        var state = null;
                        try {
                            window.location = 'clinic://'; //schema链接或者universal link
                            window.setTimeout(
                                function () {
                                    window.location =
                                        // "https://link.vvstc.com/index.html?id=com.ccclkj.clinic"
                                        "https://m.malink.cn/s/MNbuea"
                                    // "https://a.app.qq.com/o/simple.jsp?pkgname=com.ccclkj.clinic";
                                    //window.location = "http://www.ccclkj.cn:1125/zbz.apk"; 
                                    //android下载地址  
                                }, 500);
                        } catch (e) { }
                    }
                    return
                    if (isWeixin) {
                        this.showPop = true
                    } else {
                        if (window.navigator.userAgent.match(/(iPhone|iPod|iPad);?/i)) {
                            console.log("000");
                            var loadDateTime = new Date();
                            window.location = "clinic://"; //schema链接或者universal link
                            window.setTimeout(
                                function () { //如果没有安装app,便会执行setTimeout跳转下载页
                                    var timeOutDateTime = new Date();
                                    if (timeOutDateTime - loadDateTime < 5000) {
                                        window.location =
                                            "https://itunes.apple.com/cn/app/%E5%80%BC%E6%97%A5%E7%94%9F/id1448441059?mt=8"; //ios下载地址  
                                    } else {
                                        window.close();
                                    }
                                }, 500);
                        } else if (window.navigator.userAgent.match(/android/i)) {
                            var state = null;
                            try {
                                window.location = 'clinic://'; //schema链接或者universal link
                                window.setTimeout(
                                    function () {
                                        window.location =
                                            "https://a.app.qq.com/o/simple.jsp?pkgname=com.ccclkj.clinic";
                                        //window.location = "http://www.ccclkj.cn:1125/zbz.apk"; 
                                        //android下载地址  
                                    }, 500);
                            } catch (e) { }
                        }
                    }



                    // window.location.href = ' https://zbz-downlink.oss-cn-zhangjiakou.aliyuncs.com/com.ccclkj.clinic.wgt'
                    // window.location.href = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx9cf9f21ba0cbf62b&redirect_uri=http://www.ccclkj.cn/zhensuo/sys/firstLoginUserAction.action?shop_id=" + ${this.shopId} + "&response_type=code&scope=snsapi_userinfo&state=" + ${this.userId} + "#wechat_redirect`;
                },

            }
        })
    </script>

</body>

</html>